package edu.stanford.junction.tictactoe;

//import edu.stanford.junction.SwitchboardConfig;
import edu.stanford.junction.android.AndroidJunctionMaker;
import edu.stanford.junction.tictactoe.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
//import android.util.Log;
import android.util.Log;
import android.view.View;
import android.widget.Button;


public class Home extends Activity {
	
	private Button makeGameButton;
	private Button joinGameButton;
	private Button preferencesButton;
	
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        LandingScreen();
        Log.d("Home", "finished building home screen");
    }

	private void LandingScreen() {
		makeGameButton = (Button) findViewById(R.id.makeGameButton);
		joinGameButton = (Button) findViewById(R.id.joinGameButton);
       	preferencesButton = (Button) findViewById(R.id.preferencesButton);

    	makeGameButton.setOnClickListener(new View.OnClickListener() {
    		public void onClick(View v) { 
    			//AndroidJunctionMaker.getInstance().findActivityByScan(Home.this);
    			Intent game = new Intent(getBaseContext(), Game.class);
    			startActivity(game);
    		}
    	});
    	
    	joinGameButton.setOnClickListener(new View.OnClickListener() {
    		public void onClick(View v) {
				AndroidJunctionMaker.findActivityByScan(Home.this);
    		}
    	});
    	
    	preferencesButton.setOnClickListener(new View.OnClickListener() {
    		public void onClick(View v) { 
    			Intent prefs = new Intent(getBaseContext(), Preferences.class);
    			startActivity(prefs);
    		}
    	});

	}
}